package com.daou.meeting.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.daou.meeting.domain.User;
import com.daou.meeting.repository.UserRepository;

/**
 * Company Service Class
 * 
 * @author seungkyupark84
 * 
 */
@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;
    
    public User login(String email, String password) {
    	User user = userRepository.findByEmail(email);
    	if(password.equals(user.getPassword())) {
    		return user;
    	} else {
    		return null;    		
    	}
    }
    
    public List<User> onlineUser() {
    	return userRepository.findByOnline(true);
    }
        
    public void updateUser(User user) {
    	userRepository.save(user);
    }
}
